package com.zy.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.entity.ParkingLot;
import com.zy.mapper.ParkingLotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ParkingLotService extends ServiceImpl<ParkingLotMapper, ParkingLot> {
    ParkingLotMapper mapper;
    @Autowired
    public ParkingLotService(ParkingLotMapper mapper){
        this.mapper=mapper;
    }
    public List<ParkingLot> getAll(){
        List<ParkingLot> results=mapper.getAll();
        return results;
    }
    public ParkingLot getById(Long id) {
        ParkingLot entity= (ParkingLot) mapper.getById(id);
        return entity;
    }
    public boolean insert(ParkingLot entity){
        boolean result= mapper.insert(entity) > 0;
        return result;
    }

    public boolean update(ParkingLot entity){
        boolean result=mapper.update(entity)>0?true:false;
        return result;
    }
    public boolean delete(Long id) {
        int result=mapper.deleteById(id);
        return result>0?true:false;
    }
}